{extend name="public/base"/}
 {block name="content"}
  <section class="content">
           <div class="row">
	<div class="col-xs-12">
		<div class="box">
			<div class="box-header">
				<h3 class="box-title">
				<a href="{:U('Access/rule',array('id'=>$_GET['id']))}" class="btn btn-primary">访问授权</a>
				</h3>
				<h3 class="box-title">
				<a href="{:U('Access/list_rule')}" class="btn btn-primary">栏目授权</a>
				</h3>
			</div>
			<!-- /.box-header -->
			<div class="box-body">
			
			
			
             <form action="{:U('Access/save_list_rule')}" method="post">
			 <input type="hidden" value="{$_GET['id']}" name="id" />
				<table class="table table-bordered table-hover">
				<thead>
				<p style="color:red">正在为"{$groupname}"配置栏目管理权限</p>
				<input id="all" type="checkbox" value="">全选
				</thead>
				
				{volist name="info" id="data"}
				<tbody style="border:none">	
				<tr>
				<td style="font-size:15px;padding-left:30px;">

				{if condition="$data.parent_id neq 0"}&nbsp;&nbsp;&nbsp;&nbsp;{/if}
				<input name="rules[]" id="{$data.id}" class="check" parent_id="{$data.parent_id}" {in name="$data['id']" value="$li_rule"}checked{/in} type="checkbox" value="{$data.id}">
				{$data.name}
				</td>	
				</tr>				
				</tbody>
				{/volist}
				</table>
				<br/>
				
				<div class="box-footer">
                  <button type="submit" class="btn btn-primary">保存</button>
                </div>
				</form>
				
				<script type="text/javascript">
				
						$("#all").click(function(){
							if(this.checked){
								$(".check:checkbox").prop("checked", true);
							}else{
								$(".check:checkbox").prop("checked", false);
							}
						});				
				
					$(":input").change(function(){
					var parent_id = $(this).attr('parent_id');
						if(parent_id == 0){
						  var id=$(this).attr('id');
						  var inputs=$(':input[parent_id='+id+']');
                          $(this).prop('checked')?inputs.prop('checked',true):inputs.prop('checked',false);
						}else if (parent_id !=0){
						  var parent_id=$(this).attr('parent_id');
						  var inputs=$(':input[id='+parent_id+']');
						 $(this).prop('checked')?inputs.prop('checked',true):inputs.prop('checked',false);

						}

					});
				</script>
				
				
				
				
				

				
				
			</div>
		</div>
	</div>
</div>

 
			</section>
 {/block}